package com.z8888q.zlottery.menu;

import com.z8888q.zlottery.R;
import com.z8888q.zlottery.about.About;
import com.z8888q.zlottery.about.Comments;
import com.z8888q.zlottery.about.Help;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.widget.Toast;

public class MenuActivity extends Activity {
    /** Called when the activity is first created. */
	
//	private Menu mMenu;
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
//        setContentView(R.layout.main);
    }
    
    @Override
    public boolean onCreateOptionsMenu(Menu menu){
        // Hold on to this
//        mMenu = menu;        
        // Inflate the currently selected menu XML resource.
        MenuInflater inflater = getMenuInflater();
        inflater.inflate(R.menu.title_icon, menu);
        
        return super.onCreateOptionsMenu(menu);
    }
    
    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        switch (item.getItemId()) {
        case R.id.menu_help:{
			Intent intent= new Intent();
			intent.setClass(this,Help.class);
			startActivity(intent);
			break;
        }
        case R.id.menu_comments:{
			Intent intent= new Intent();
			intent.setClass(this,Comments.class);
			startActivity(intent);
			break;
        }
        case R.id.menu_about:{
            LayoutInflater factory=LayoutInflater.from(this);
            View view=factory.inflate(R.layout.alert_self,null);
            About about2=new About(this,view);
        	about2.setDirection();
/*			Intent intent= new Intent();
			intent.setClass(this,About.class);
			startActivity(intent);*/
			break;
        }
        
        default:
            // Don't toast text when a submenu is clicked
            if (!item.hasSubMenu()) {
                Toast.makeText(this, item.getTitle(), Toast.LENGTH_SHORT).show();
                return true;
            }
            break;        
        }
        return false;
    }	    
}